<?php

require  './vendor/autoload.php';

$client = new MongoDB\Client('mongodb://192.168.1.25:27017');
$database = $client->selectDatabase('test');
$col = $database->selectCollection('repeat_phone_num');

$a = '10000000000';
for ($i = 0; $i <= 10000; $i++)
{
    $time_str = '2017-06-';
    $nocon = rand(1, 100);
    $con = rand(1, 100);
    $time_num = rand(1, 30);
    if (strlen($time_num) == 1) {
        $time_num = '0'.$time_num;
        $time_str .= $time_num;
    } else {
        $time_str .= $time_num;
    }
    $data = array(
        'vcc_id' =>(int) 0,
        'call_type' => (int) rand(1,2),
        'phone' => (string) $a++,
        'nocon_num' => (int) $nocon,
        'con_num' => (int) $con,
        'total_num' => (int) ($nocon + $con),
        'date' => (string) $time_str,
    );
    $col->insertOne(
        $data
    );
}


